{% extends 'TopxiaAdminBundle:Content:layout.html.twig' %}

{% block title %}资讯管理 - {{ parent() }}{% endblock %}

{% set script_controller = 'article/list' %}

{% set menu = 'article' %}

{% block main %}

<div class="page-header clearfix">
  <a class="btn btn-info btn-sm pull-right" id="article-add-btn" type="button" href="{{ path('admin_article_create') }}"><span class="glyphicon glyphicon-plus"></span> 添加资讯</a>
  <h1 class="pull-left">资讯管理</h1>
</div>

<form class="well well-sm form-inline" action="{{ path('admin_article') }}">
	<div class="form-group">
		<select class="form-control" name="categoryId">
		 <option value="">--所属栏目--</option>
		   {% for tree in categoryTree %}
					<option value={{ tree.id }} {% if tree.id == categoryId  %}selected{% endif%}>{% for i in 0..(tree.depth-1)*2 %}&nbsp;&nbsp;&nbsp;&nbsp;{% endfor %}└─ {{ tree.name }}</option>
					{% endfor %}
		</select>
	</div>
	<div class="form-group">
		<input class="form-control" name="keywords" type="text" placeholder="标题关键词" value="{{ app.request.query.get('keywords') }}">
	</div>
	<div class="form-group">
		<select class="form-control" name="property">
		  {{ select_options(dict('articleProperty'), app.request.query.get('property'), '--属性--') }}
		</select>
	</div>
	<div class="form-group">
		<select class="form-control" name="status">
		  {{ select_options(dict('articleStatus'), app.request.query.get('status'), '--发布状态--') }}
		</select>
	</div>
	<button class="btn btn-primary pull-right" type="submit">搜索</button>
</form>

<div id="aticle-table-container">

<table class="table table-hover table-striped" id="article-table">
	<thead>
		<tr>
			<th width="10%"><input type="checkbox"  data-role="batch-select"> ID</th>
			<th width="20%">资讯标题</th>
			<th width="15%">栏目</th>
			<th width="18%">更新时间</th>
			<th width="15%">属性</th>
			<th width="10%">状态</th>
			<th width="15%">操作</th>
		</tr>
	</thead>
	<tbody>
		{% if articles %}
			{% for article in articles %}
			  {% set category = categories[article.categoryId]|default(null) %}
			  {% include 'TopxiaAdminBundle:Article:article-tr.html.twig' %}
			{% endfor %}
		{% else %}
			<tr><td colspan="20"><div class="empty">暂无页面记录</div></td></tr>
		{% endif %}
	</tbody>
	</table>
  <div>
    <label class="checkbox-inline"><input type="checkbox" data-role="batch-select"> 全选</label>
    <button class="btn btn-default btn-sm mlm" data-role="batch-delete"  data-name="资讯" data-url="{{ path('admin_article_delete') }}">删除</button>
  </div>
  </div>

{{ web_macro.paginator(paginator) }}

{% endblock %}